﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;

public partial class ucSignIn : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            
            if (Session["Customer"] == null)
            {

                lbtnLogin.Text = "Login";
                lbtnRegister.Text = "Register";
            }
            else
            {
                Customer cus = (Customer)Session["Customer"];
                lbtnRegister.Text = "Sign Out"; ;
                lbtnLogin.Text = "Welcome! " + cus.CusUser;
            }
        }
    }
    protected void lbtnLogin_Click(object sender, EventArgs e)
    {
        if (Session["Customer"] == null)
        {
            Response.Redirect("Login.aspx");
        }
    }
    protected void lbtnRegister_Click(object sender, EventArgs e)
    {
        if (Session["Customer"] == null)
        {
            Response.Redirect("Register.aspx");
        }
        else
        {
            Session["ProID"] = null;
            Session["Customer"] = null;
            Response.Redirect("Default.aspx");
            //FormsAuthentication.RedirectToLoginPage();
        }
    }
}
